# from openpyxl import load_workbook
# from openpyxl import Workbook
#
# target_file_path = r'D:\Desktop\新建文件夹 (2)\2025年度储备项目_2024_12_02_17_48_56 - 副本.xlsx'
# save_file_path = r'D:\Desktop\新建文件夹 (2)\2025年度储备项目_2024_12_02_17_48_56 - 副本save.xlsx'
# target_wb = load_workbook(target_file_path)
# target_ws = target_wb['主表']
#
#
# source1_file_path = r'D:\Desktop\新建文件夹 (2)\附件1：2024年结转项目情况表_地方报送_汇总1121.xlsx'
# source2_file_path = r'D:\Desktop\新建文件夹 (2)\附件2：2.2025年新开工项目情况表_地方报送_汇总1121.xlsx'
#
#
# source1_wb = load_workbook(source1_file_path)
#
#
# source2_wb = load_workbook(source2_file_path)
#
# source1_ws = source1_wb['项目情况表']
#
# source2_ws = source2_wb['项目情况表']
#
# i = 10151
# while target_ws[f'D{i}'].value is not None and str(target_ws[f'D{i}'].value).strip() != '':
#     j = 3
#     while source1_ws[f'B{j}'].value is not None and str(source1_ws[f'B{j}'].value).strip() != '':
#         if source1_ws[f'B{j}'].value == target_ws[f'D{i}'].value:
#             print('表1执行')
#             target_ws[f'E{i}'].value = source1_ws[f'C{j}'].value
#             target_ws[f'U{i}'].value = source1_ws[f'L{j}'].value
#         j += 1
#
#     k = 2
#     while source2_ws[f'B{k}'].value is not None and str(source2_ws[f'B{k}'].value).strip() != '':
#         if source2_ws[f'B{k}'].value == target_ws[f'D{i}'].value:
#             print('表2执行')
#             target_ws[f'E{i}'].value = source2_ws[f'C{k}'].value
#             target_ws[f'U{i}'].value = source2_ws[f'J{k}'].value
#             target_ws[f'I{i}'].value = source2_ws[f'F{k}'].value
#         k += 1
#     i += 1
#
#
# source1_wb.close()
# source2_wb.close()
# target_wb.save(save_file_path)
# target_wb.close()
#
#
#
#
#
#
#
#
